namespace JQuery.WebKit
{
    using System.ComponentModel;
    using System.Security.Permissions;
    using System.Web;

    [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public class WebGridSortEventArgs : CancelEventArgs
    {
        private JQuery.WebKit.SortDirection _sortDirection;
        private string _sortExpression;

        public WebGridSortEventArgs(string sortExpression, string sortDirection)
        {
            this._sortExpression = sortExpression;
            if (sortDirection != null)
            {
                this._sortDirection = (sortDirection.ToLower() == "asc") ? JQuery.WebKit.SortDirection.Asc : JQuery.WebKit.SortDirection.Desc;
            }
            else
            {
                this._sortDirection = JQuery.WebKit.SortDirection.Asc;
            }
        }

        public JQuery.WebKit.SortDirection SortDirection
        {
            get
            {
                return this._sortDirection;
            }
            set
            {
                this._sortDirection = value;
            }
        }

        public string SortExpression
        {
            get
            {
                return this._sortExpression;
            }
            set
            {
                this._sortExpression = value;
            }
        }
    }
}

